#include "DynamicLibrary.h"


DynamicLibrary::DynamicLibrary(const std::string &libraryName)
{
    // 初始化成员变量
    this->libraryName = libraryName;
    this->hModule = nullptr;

    // 构造函数中加载DLL
    hModule = LoadLibraryA(libraryName.c_str());
    if (!hModule)
    {
        std::cerr << "Failed to load DLL: " << libraryName << std::endl;
    }
}

DynamicLibrary::~DynamicLibrary()
{
    // 析构函数中卸载DLL
    if (hModule)
    {
        FreeLibrary(hModule);
    }
}
